<template>
	<view class="remeng">
		<view v-for="(item,index) in hotlist" :key="index" @click="rewtiaoz(item)">
		     <view class="left">
		     	 <image :src="item.image_input"></image>
		     </view>
		     <view class="right">
		     	<view class="title">{{item.title}}</view>
		     	<view class="msg">{{item.synopsis}}</view>
		     	<view class="tiem">
		     		<text>{{item.create_time}}</text>
		     		<text>{{item.visit ? item.visit : 0 }}次阅读量</text>
		     	</view>
		     </view>
		</view>
	</view>
</template>

<script>
	import {
		getArticleMerList
	} from '@/api/api.js';
	export default {
		data() {
			return {
				hotlist:[],
				mer_id:0
			};
		},
		onLoad(e) {
			console.log(e)
			if(e.merId){
				this.mer_id = e.merId
			}
			this.getHotList()
		},
		onShareAppMessage(){
			return { // 自定义分享内容
				title: "推荐热文列表",
				path: `/pages/userminp/recomArticleList/recomArticleList?merId=` + this.mer_id 
			}
		},
		onShareTimeline(){
			return { // 自定义分享内容
				title: "推荐热文列表",
				path: `/pages/userminp/recomArticleList/recomArticleList?merId=` + this.mer_id 
			}
		},
		methods:{
			// 推荐热文
			getHotList() {
				console.log(this.mer_id)
				getArticleMerList(this.mer_id,9999).then((res) => {
					console.log(res.data, "res.............")
					this.hotlist = res.data.list
				})
			},
			rewtiaoz(item) {
			   // if (!this.isLogin) {
			   //      uni.showToast({
			   //           title: '请登录',
			   //           icon: 'none'
			   //      })
			   //      setTimeout(() => {
			   //           uni.navigateTo({
			   //                url: '/pages/users/wechat_login/index'
			   //           })
			   //      }, 1000)
			   //      return;
			   // }
			   uni.navigateTo({
					url: '/pages/news_details/index?id=' + item.article_id
			   })
			},
		}
	}
</script>

<style lang="scss" scoped>
	.remeng {
	     // margin-top: 20rpx;
	     background-color: #fff;
	     border-radius: 8rpx;
	     padding: 48rpx;
		 &>view{
			display: flex;
			align-items: center;
			margin-bottom: 20rpx;
		 }
		 .left{
			 display: inline-block;
			 image{
				 width: 200rpx;
				 height:120rpx;
				 border-radius: 20rpx;
			 }
		 }
		 .right{
			 &>view{
				margin: 10rpx 0;
			 }
			 display: inline-block;
			 margin-left: 10px;
			 width: 600rpx;
			 .title{
				 width: 100%;
				 font-size: 32rpx;
				 font-weight: 600;
			 }
			 .msg{
				 font-size: 24rpx;
			 }
			 .tiem{
				 width: 100%;
				 font-size: 24rpx;
				 color: gray;
				 display: flex;
				 justify-content: space-between;
			 }
		 }
	}
</style>
